package dev.meow.core;

public class SMC_TH {

	public static byte[][] CMD_CID = new byte[][] {
			{ (byte) 0x80, (byte) 0xb0, 0x00, 0x04, 0x02, 0x00, 0x0d },
			{ 0x00, (byte) 0xc0, 0x00, 0x00, 0x0d } };

	// Fullname Thai + Eng + BirthDate + Sex
	public static byte[][] CMD_PERSON_INFO = new byte[][] {
			{ (byte) 0x80, (byte) 0xb0, 0x00, 0x11, 0x02, 0x00, (byte) 0xd1 },
			{ 0x00, (byte) 0xc0, 0x00, 0x00, (byte) 0xd1 } };

	// Address
	public static byte[][] CMD_ADDRESS = new byte[][] {
			new byte[] { (byte) 0x80, (byte) 0xb0, 0x15, 0x79, 0x02, 0x00, 0x64 },
			new byte[] { 0x00, (byte) 0xc0, 0x00, 0x00, 0x64 } };

	// issue/expire
	public static byte[][] CMD_CARD_ISSUE_EXPIRE = new byte[][] {
			new byte[] { (byte) 0x80, (byte) 0xb0, 0x01, 0x67, 0x02, 0x00, 0x12 },
			new byte[] {  0x00, (byte) 0xc0, 0x00, 0x00, 0x12 } };

	// Select/Reset
	public static byte[] CMD_SELECT = new byte[] { 0x00, (byte) 0xA4, 0x04,
			0x00, 0x08, (byte) 0xA0, 0x00, 0x00, 0x00, 0x54, 0x48, 0x00, 0x01 };
	
    public static CMDP[] GET_CMD_CARD_PHOTO()
    {
    	CMDP[] cmds = new CMDP[21];
        for (int i = 0; i <= 20; i++)
        {
            int xwd;
            int xof = i * 254 + 379;
            if (i == 20)
                xwd = 38;
            else
                xwd = 254;

            int sp2 = (xof >> 8) & 0xff;
            int sp3 = xof & 0xff;
            int sp6 = xwd & 0xff;
            int spx = xwd & 0xff;

            cmds[i] = new CMDP();
            cmds[i].CMD1 = new byte[] { (byte) 0x80, (byte) 0xb0, (byte)sp2, (byte)sp3, 0x02, 0x00, (byte)sp6 };
            cmds[i].CMD2 = new byte[] { 0x00, (byte) 0xc0, 0x00, 0x00, (byte)spx };
        }

        return cmds;
    }

}

